package com.xinye.opencvdemo.utils

import java.util.concurrent.Executors

object ThreadUtils {
    private val sIOPool = Executors.newFixedThreadPool(4)
    private val sComputePool = Executors.newFixedThreadPool(16)

    fun addIOTask(task: Runnable){
        sIOPool.execute(task)
    }

    fun addIOTask(task: () -> Unit){
        sIOPool.execute { task() }
    }

    fun addComputeTask(task: Runnable){
        sComputePool.execute(task)
    }

    fun addComputeTask(task: () -> Unit){
        sComputePool.execute { task() }
    }
}